package qz_rpt

class UserWorkByDayController {

    def commonDataService
    def dynamicQueryService
    def index(Integer max) {
        def cellList = org.kdx.DataUtils.getCellList()
        def pageSizeList = org.kdx.DataUtils.getPageSizeList()

        [totalCount: 5, pageSize: 20, pageCurrent: 1, orderField: 'id', orderDirection: 'asc', pageSizeList: pageSizeList, cellList: cellList]
    }
    def userWorkByDay(){
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def pageSizeList = [10,20,50,100]
        params.SYS_QUERY_NAME = 'userWorkByDay'
        def userWorkByDay = dynamicQueryService.queryForList(params)
        def tableHeadList =  []
        if(userWorkByDay.size()>0){
            tableHeadList =  userWorkByDay[0].keySet()
        }
        params.SYS_QUERY_NAME = 'userWorkByDayCount'
        def totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT
        params.SYS_QUERY_NAME = 'userWorkByDayUser'
        def userWorkByDayUesr = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'userWorkByDayUserNo'
        def userWorkByDayUserNo = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'userWorkByDayStepList'
        def userWorkByDayStepList = dynamicQueryService.queryForList(params)
        params.SYS_QUERY_NAME = 'userWorkByDayPartNameList'
        def userWorkByDayPartNameList = dynamicQueryService.queryForList(params)
        [totalCount:totalCount,tableHeadList:tableHeadList,
         pageSizeList:pageSizeList,pageSize:pageSize,
         startno:params.startno?:'',endno:params.endno?:'',user:params.user?:'',
         userWorkByDay:userWorkByDay,userWorkByDayUesr:userWorkByDayUesr,userWorkByDayPartNameList:userWorkByDayPartNameList
         ,startTime:params.startTime?:'',endTime:params.endTime?:'',userWorkByDayStepList:userWorkByDayStepList,step:params.step?:'',partName:params.partName?:'',
         userWorkByDayUserNo:userWorkByDayUserNo,userNo:params.userNo?:'']
    }
}
